home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Snippets / Stuart's Tech Notes / Moving the mouse pointer.c < prev    next >
Text File  |  1994-12-10  |  930b  |  32 lines

  1. // (C) 1992 Stuart Cheshire <cheshire@cs.stanford.edu>
  2. // The user moves the mouse pointer with the mouse.
  3. // A program moving the mouse pointer is stricly against Apple guidelines,
  4. // and is guaranteed to annoy your users in 99% of cases.
  5. //
  6. // However, Bolo moves the mouse pointer when the map scrolls, so that the
  7. // building cursor stays in the same place relative to the map, and amazingly,
  8. // no one has flamed me for it. Not even anyone at Apple.
  9. //
  10. // So, it can be done, and here is how:
  11.  
  12. #include "StuTypes.h"
  13.  
  14. Point MTemp     : 0x828;
  15. Point RawMouse  : 0x82C;
  16. Point Mouse     : 0x830;
  17. char CrsrNew    : 0x8CE;
  18. char CrsrCouple : 0x8CF;
  19.  
  20. export void offset_mouse_location(short xoff, short yoff)
  21.     {
  22.     short statusregister = Disableinterrupts();
  23.     Mouse.h += xoff;
  24.     Mouse.v += yoff;
  25.     MTemp.h += xoff;
  26.     MTemp.v += yoff;
  27.     RawMouse.h += xoff;
  28.     RawMouse.v += yoff;
  29.     CrsrNew = CrsrCouple;
  30.     RestoreInterrupts(statusregister);
  31.     }
  32.